package com.talkweb.sendmsg.controller;

import com.talkweb.sendmsg.service.MsgProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.jms.Queue;

@RestController
@RequestMapping("/msg")
public class ActiveMqController {

	@Autowired
	private Queue queue;
	@Autowired
	private MsgProducer msgProducer;

	/**
	 * 发送到默认的消息队列中
	 * @param msg 发送的消息
	 */
	@GetMapping("/queue/{msg}")
	public Object sendQueue(@PathVariable("msg") String msg) {
		msgProducer.sendMessage(msg);
		return "success";
	}
}
